home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / tess / tess-1.0 / p4g.m < prev    next >
Encoding:
Text File  |  1992-06-30  |  825 b   |  41 lines

  1. #import "aGroup-inter.h"
  2. #import "aGroup.h"
  3. #import "p4g.h"
  4.  
  5. @implementation p4g
  6. - clip: (float) x : (float) y
  7. {
  8.   PSmoveto(x,y);
  9.   PSrlineto(bounds.size.width,0);
  10.   PSrlineto(-bounds.size.width,bounds.size.height);
  11.   PSclosepath();
  12.   PSclip();
  13.   return self;
  14. }
  15. - makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
  16. {
  17.   id imgrep;
  18.   NXPoint pt;
  19.   int i;
  20.   
  21.   pt.x = - point->x ;
  22.   pt.y = - point->y ;
  23.  
  24.   imgrep = [srcimg bestRepresentation];
  25.   for(i=0;i<4;i++){
  26.     PSgsave(); // lower left
  27.        PSrotate(90*i);
  28.        PSgsave();
  29.          [self clip:0.0:0.0];[imgrep drawAt: &pt];
  30.        PSgrestore();
  31.        PSgsave();
  32.          reflect(135);
  33.          PStranslate(bounds.size.width,bounds.size.height);
  34.          [self clip:0.0:0.0];[imgrep drawAt: &pt];
  35.        PSgrestore();
  36.     PSgrestore();
  37.   }
  38.   return self;
  39. }
  40. @end
  41.